home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_nub_bossdoor.cog < prev    next >
Text File  |  1999-11-15  |  26KB  |  980 lines

  1. # Jones 3D Cog Script
  2. #
  3. # nub_BossDoor.cog
  4. #
  5. # [TL] [MDR] [GGJ]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ========================================================================================
  10. symbols
  11.  
  12. message            startup
  13. message            activated
  14. message            arrived
  15. message            entered
  16. message            exited
  17. message            pulse
  18. message            damaged
  19. message            touched
  20. message            callback
  21.  
  22. # ************************** SUBROUTINES ********************
  23. flex            BossDeadCutscene                local
  24. flex            ChargePadFx                        local
  25. flex            DischargePadFx                    local
  26.  
  27. # ********************** MISC LINKED STUFF ******************
  28. thing            top
  29. thing            door0            
  30. thing            door1
  31. thing            elev0
  32. thing            sarcfull
  33. thing            sarcempty
  34. thing            invissarc
  35. thing            moveeye
  36. thing            boss
  37. thing            cam0
  38. thing            cam1
  39. thing            indy
  40. cog                cog_Boss
  41. cog                hint
  42. thing            riseGhost
  43. thing            risenGhost
  44.  
  45. # ********************** MISC GEOM **************************
  46. surface            openface
  47. surface            dooradjoin
  48.  
  49. # ********************** PADS O' DEATH **********************
  50. int                i_NumPads=4                        local
  51. surface            pad0            mask=0x404                    #northeast
  52. surface            pad1            mask=0x404                    #southeast
  53. surface            pad2            mask=0x404                    #southwest
  54. surface            pad3            mask=0x404                    #northwest
  55.  
  56. surface            ledge0
  57. surface            ledge1
  58. surface            ledge2
  59. surface            ledge3
  60.  
  61. thing            charger0        mask=0x08
  62. thing            charger1        mask=0x08
  63. thing            charger2        mask=0x08
  64. thing            charger3        mask=0x08
  65. int                pad0charged=0                    local
  66. int                pad1charged=0                    local
  67. int                pad2charged=0                    local
  68. int                pad3charged=0                    local
  69. int                pad0track                        local
  70. int                pad1track                        local
  71. int                pad2track                        local
  72. int                pad3track                        local
  73.  
  74. int         north=0             local
  75. int         east=1              local
  76. int         south=2             local
  77. int         west=3              local
  78.  
  79. int            camspot                local
  80. vector        v_bosslvec            local
  81. vector        v_bossface            local
  82. flex        f_dot                local
  83.  
  84.  
  85.  
  86. int                b_hitBoss=0                        local
  87. int                b_hitPlayer=0                    local
  88. int                n_BossPad=-1                    local    # Current pad boss is on
  89. int                n_PlayerPad=-1                    local    # Current pad player is on
  90.  
  91. vector            vec_padCenter                    local    # Track Boss' position on death pad
  92.  
  93. # ********************** MISC LOCAL STUFF *******************
  94. int                n_sender                        local
  95. thing            t_Player                        local
  96. thing            t_RealBoss                        local
  97. thing            sarcTarg0
  98. thing            sarcTarg1
  99. thing            sarcCam
  100. thing            camTarg
  101. thing            actor                            local
  102. thing            actorGhost
  103. thing            sarcCharger        mask=0x08
  104. thing            invisibox0                                        #GGJ boxes for lid
  105. thing            kneelActor                        local
  106. thing            topCam
  107.  
  108. thing            deadCam0                                        #north
  109. thing            deadCam1                                        #east
  110. thing            deadCam2                                        #south
  111. thing            deadCam3                                        #west
  112.  
  113.  
  114. sector            sec_pos                            local
  115.  
  116. int                n_pad                            local
  117. int                sarcdoneflag=0                    local
  118. int                sarcopenflag=0                    local
  119. int                unlocked=0                        local
  120. int                tracknum0                        local
  121. int                tracknum1                        local
  122. int                n_idx                            local
  123. int                bossOnce=0                        local
  124. int                callbackOnce=0                    local
  125. int                callbackNum                        local
  126. int                CSShake=0                        local
  127. int                vibe                            local
  128.  
  129. vector            vec_pos                            local
  130. vector            vec_dir                            local
  131. vector            v_targetpos                        local
  132. flex            f_val                            local
  133. flex            headturn                        local
  134.  
  135. vector            posOffset                        local
  136. vector            angOffset                        local
  137.  
  138.  
  139. # ************************** SPECIAL FX *********************
  140. template        tpl_sparks=rbossFntnLG                    local
  141. template        tpl_glow=rbossElecGlow                    local
  142. template        tpl_arcs=rbossElecArc                    local
  143.  
  144. int                n_snd                                    local
  145. int                kneeltrack                                local
  146. int                bossSndTrack1                            local
  147. int                bossSndTrack2                            local
  148.  
  149.  
  150. # ************************** MISC TEMPLATES *****************
  151. template        actortpl=indy_sh_actor                    local
  152.  
  153. keyframe        sarcopen=nub_srcfgs_open.key            local
  154. keyframe        sarcclose=nub_srcfgs_close.key            local
  155. keyframe        openKey=0in_armsup_1_1.key                local        #indy
  156. keyframe        grabKey=0in_reach_jewel.key                local
  157. keyframe        kneel=0in_stand6.key                       local
  158. keyframe        kneelDown=0in_stand1_bd_6.key                  local
  159. keyframe        standUp=0in_stand6_bd_1.key                   local
  160. keyframe        in_botharmsup=0in_armsup_1_1.key        local
  161. keyframe        in_ltarmup=0in_leftarm_1_1.key            local
  162. keyframe        key_inShock=in_hit_shocked.key            local
  163.  
  164. sound            eyeplaced=nub_anubisarm_place_c.wav        local
  165. sound            nubVoice=NB07j01.wav                    local
  166. sound            eyeVoice=NB07j02.wav                    local
  167. sound            fits=INXJ109.WAV                        local        #It fits!
  168. sound            socketVoice=NB08j01.wav                    local
  169. sound            bossMus=mus_gen_awesome1.wav             local
  170. sound            bossDieMus=mus_gen_indyrelief.wav        local
  171. sound            pyrMoveSnd=nub_pyr_top_move_c.wav        local
  172. sound            pyrStopSnd=shs_statue_stop.wav            local
  173. sound            sarcOpenSnd=nub_sarc_open_c.wav            local
  174. sound            sarcFlipSnd=nub_sarc_jewel_turn_c.wav    local
  175. sound            sarcCloseSnd=nub_sarc_close_c.wav        local
  176. sound            snd_chargerMove=sea_crane_start_c.wav    local
  177. sound            snd_padHum=nub_charged_pad_c.wav        local
  178. sound            bossRaiseSnd=nub_boss_raise_c.wav        local
  179. sound            bossComment=NB08J02.WAV                    local
  180. sound            snd_shock=sol_trnsfrmr_zap.wav            local       # zzzap!
  181. sound            snd_ow=inxj017g.wav                        local       # ow!
  182.  
  183. flex            temp            local
  184. end
  185.  
  186. # ========================================================================================
  187. code
  188.  
  189. # ........................................................................................
  190. startup:
  191.  
  192.     t_RealBoss = -1;
  193.  
  194.     Sleep(0.01);
  195.     
  196.     SetSurfaceFlags(ledge0, 0x1000000);
  197.     SetSurfaceFlags(ledge1, 0x1000000);
  198.     SetSurfaceFlags(ledge2, 0x1000000);
  199.     SetSurfaceFlags(ledge3, 0x1000000);
  200.  
  201.     t_Player = GetLocalPlayerThing();
  202.  
  203.     AttachThingToThing(moveeye, elev0);
  204.     AttachThingToThing(boss, elev0);
  205.  
  206.     SetCollideType(door0, 0);
  207.     SetCollideType(door1, 0);
  208.     SetThingFlags(sarcempty, 0x80000);
  209.     SetThingFlags(moveeye, 0x10);
  210.  
  211.     SetThingLight(door0, '0.5 0.5 0.5', 0.1, 0.5);
  212.     SetThingLight(door1, '0.5 0.5 0.5', 0.1, 0.5);
  213.     SetThingLight(elev0, '0.5 0.5 0.5', 0.1, 0.5);
  214.     SetThingLight(boss, '0.5 0.5 0.5', 0.1, 0.5);
  215.  
  216.     SetThingFlags(indy, 0x80000);
  217.  
  218.     SetCollideType(invisibox0, 0);
  219.  
  220.     #call temp;
  221.     
  222.     return;
  223.  
  224.  
  225. #........................................................................................
  226. entered:
  227.  
  228.     if (GetSenderRef() == openface)
  229.     {
  230.         unlocked = 1;
  231.         print("...click...");
  232.     }
  233.  
  234.     for (n_idx=0; n_idx<i_NumPads; n_idx=n_idx + 1)
  235.     {
  236.         if ( GetSenderRef() == pad0[n_idx] )
  237.         {
  238. #            DEBUGPRINT("Entered a pad");                    #Shouldn't pulse be after pad is set?
  239.             SetPulse(0.05);
  240.  
  241.             # Did BOSS step on a charged pad?
  242.             if ( GetSourceRef() == t_RealBoss )
  243.             {
  244. #                DEBUGFLEX(n_idx, "Boss entered pad");
  245.                 n_BossPad        = n_idx;
  246.  
  247.                 return;
  248.             }
  249.  
  250.             if ( GetSourceRef() == t_Player )
  251.             {
  252. #                DEBUGFLEX(n_idx, "Player entered pad");
  253.                 n_PlayerPad        = n_idx;
  254.  
  255.                 return;
  256.             }
  257.         }
  258.     }
  259.  
  260.     return;
  261.  
  262.  
  263. #........................................................................................
  264. exited:
  265.  
  266.     if (GetSenderRef() == openface)
  267.     {
  268.         unlocked = 0;
  269.         print("...kachunk...");
  270.     }
  271.  
  272.     for (n_idx=0; n_idx < i_NumPads; n_idx=n_idx + 1)
  273.     {
  274.         if ( GetSenderRef() == pad0[n_idx] )
  275.         {
  276.             # Boss stepping off one of the death pads?
  277.             if ( GetSourceRef() == t_RealBoss )
  278.             {
  279. #                DEBUGFLEX(n_idx, "Boss exited pad");
  280.                 n_BossPad = -1;
  281.             }
  282.  
  283.             if ( GetSourceRef() == t_Player )
  284.             {
  285. #                DEBUGFLEX(n_idx, "Player exited pad");
  286.                 n_PlayerPad = -1;
  287.             }
  288.         }
  289.     }
  290.  
  291.     return;
  292.  
  293.  
  294. #........................................................................................
  295. pulse:
  296.     if (CSShake == 1)
  297.     {
  298.         #rumbleVol = rumbleVol * 1.001;
  299.         #PrintFlex(rumblevol);
  300.         #ChangeSoundVol(rumbleTrack, rumbleVol, 0.1);
  301.         #PrintInt(rumbletrack);
  302.    
  303.         vibe = randBetween(1, 4);
  304.         
  305.         
  306.         if (vibe == 1)
  307.         {
  308.             posOffset = '-0.005 0.00 -0.002';
  309.             angOffset = '0.00 -0.002 0.002';
  310.         }
  311.         if (vibe == 2)
  312.         {
  313.             posOffset = '0.005 -0.005 0.002';
  314.             angOffset = '0.002 0.00 -0.002';
  315.         }
  316.         if (vibe == 3)
  317.         {
  318.             posOffset = '0.002 0.005 -0.005';
  319.             angOffset = '-0.002 0.002 -0.002';
  320.         }
  321.         if (vibe == 4)
  322.         {
  323.             posOffset = '-0.002 0.00 0.005';
  324.             angOffset = '0.00 0.00 0.002';
  325.         }
  326.  
  327.         SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  328.  
  329.         return;
  330.     }
  331.  
  332.     if ( (n_BossPad > -1) && (b_hitBoss == 0) )                # Boss on a death pad?
  333.     {
  334.         if ( pad0charged[n_BossPad] == 1 )                        # Pad is charged?
  335.         {
  336.             vec_pos    = GetThingPos(t_RealBoss);
  337.             vec_pos    = VectorSet(VectorX(vec_pos), VectorY(vec_pos), 0);
  338.  
  339.             vec_padCenter    = GetSurfaceCenter(pad0[n_BossPad]);
  340.             vec_padCenter    = VectorSet(VectorX(vec_padCenter), VectorY(vec_padCenter), 0);
  341. #            DEBUGFLEX(VectorDist(vec_pos, vec_padCenter), "Boss dist to pad center =");
  342.  
  343.             if ( VectorDist(vec_pos, vec_padCenter) < 0.12 )    # Is victim approx centered on pad?
  344.             {
  345. #                DEBUGFLEX(n_BossPad, "Boss discharging pad");
  346.                 b_hitBoss = 1;
  347.  
  348.                 call DischargePadFx;
  349.  
  350.                 if ( GetHealth(t_RealBoss) <= 0 )
  351.                 {
  352.                     call BossDeadCutscene;
  353.                 }
  354.             }
  355.         }
  356.     }
  357.  
  358.     if ( (n_PlayerPad > -1) && (b_hitPlayer == 0) )            # Player on a death pad?
  359.     {
  360.         if ( pad0charged[n_PlayerPad] == 1 )                    # Pad is charged?
  361.         {
  362. #            DEBUGFLEX(n_PlayerPad, "Player on charged pad");
  363.             vec_pos    = GetThingPos(t_Player);
  364.             vec_pos    = VectorSet(VectorX(vec_pos), VectorY(vec_pos), 0);
  365.  
  366.             vec_padCenter    = GetSurfaceCenter(pad0[n_PlayerPad]);
  367.             vec_padCenter    = VectorSet(VectorX(vec_padCenter), VectorY(vec_padCenter), 0);
  368. #            DEBUGFLEX(VectorDist(vec_pos, vec_padCenter), "Player dist to pad center =");
  369.  
  370.             if ( VectorDist(vec_pos, vec_padCenter) < 0.16 )    # Is player approx centered on pad?
  371.             {
  372.                 b_hitPlayer = 1;
  373.  
  374.                 call DischargePadFx;
  375.  
  376.                 ClearActorFlags(t_Player, 0x200000);
  377.             }
  378.         }
  379.     }
  380.  
  381.     if ( (CSShake == 0) && (n_BossPad == -1) && (n_PlayerPad == -1) )
  382.     {
  383.         SetPulse(0);
  384.     }
  385.  
  386.     return;
  387.  
  388.  
  389. #........................................................................................
  390. activated:
  391. if (GetCurWeapon(t_player) != 0) return;
  392.  
  393.     if ((GetSenderRef() == invissarc) && (unlocked == 1))
  394.     {
  395.         if ( sarcopenflag == 0 )
  396.         {
  397.             sarcopenflag = 1;
  398.             
  399.             SetThingFlags(t_Player, 0x80000);
  400.             if ( MakeMeStop() == -1 )
  401.                 return;
  402.             DeSelectWeaponWait(t_Player);
  403.             StartCutscene(1);
  404.             
  405.             actor = CreateThing(actorTpl, actorGhost);
  406.             CaptureThing(actor);
  407.             
  408.             CopyPlayerHolsters(t_Player, actor);
  409.             ClearThingFlags(actor, 0x80000);
  410.             
  411.             SetCameraLookInterp(2, 0); # no p & t
  412.             SetCameraPosInterp(2, 0); # no dolly
  413.             SetCameraFocus(2, sarcCam);
  414.             SetCameraSecondaryFocus(2, sarcTarg0);
  415.             SetCurrentCamera(2);
  416.             SetCameraFOV(90, 0, 0.0);
  417.             MoveThingToPos(sarcCam, GetThingPos(camTarg), 6.5);
  418.             MoveThingToPos(sarcTarg0, GetThingPos(sarcTarg1), 6.5);
  419.             Sleep(1.0);
  420.             
  421.             PlayKey(actor, openKey, 2, 0x12, 0);
  422.             Sleep(0.5);
  423.             PlaySoundThing(sarcOpenSnd, sarcFull, 1.0, -1.0, -1.0, 0x0);
  424.             tracknum0=PlayKey(sarcfull, sarcopen, 4, 0x4, 0);
  425.             SetCollideType(invisibox0, 1);
  426.             
  427.             return;
  428.         }
  429.         else if ( sarcopenflag == 1 )
  430.         {
  431.             if ( sarcdoneflag == 0 )
  432.             {
  433.                 #sarcdoneflag = 1;
  434.                 #StartCutscene(1);
  435.                 #SetActorFlags(t_Player, 0x200000);
  436.                 #StopThing(t_Player);
  437.                 #PlayMode(t_Player, 1, 1);
  438.                 #PlayMode(t_Player, 60, 1);
  439.             
  440.                 #ClearActorFlags(t_Player, 0x200000);
  441.                 #EndCutScene();
  442.                 return;
  443.             }
  444.             else
  445.             {
  446.                 StartCutscene(1);
  447.                 SetActorFlags(t_Player, 0x200000);
  448.                 StopThing(t_Player);
  449.                 PlayMode(t_Player, 1, 1);
  450.                 PlayMode(t_Player, 60, 1);
  451.                 print("nope...");
  452.                 ClearActorFlags(t_Player, 0x200000);
  453.                 EndCutScene();
  454.                 return;
  455.             }
  456.         }
  457.     }
  458.  
  459.     # Player put robot gem-eye into floor slot?
  460.     if ( (GetSenderRef() == moveeye) && (GetCurItem(t_Player) == 78) )
  461.     {
  462.         SendMessage(hint, USER6);
  463.  
  464.         #PlayMode(t_Player, 60, 1);
  465.         
  466.         #Sleep(2.0);
  467.         if ( MakeMeStop() == -1 )
  468.             return;
  469.         StartCutscene(1);
  470.         kneelActor=createThing(actorTPL, t_Player);
  471.         CaptureThing(kneelActor);
  472.         CopyPlayerHolsters(t_Player, kneelActor);
  473.         SetThingFlags(t_Player, 0x80000);
  474.         ClearThingFlags(kneelActor, 0x80000);
  475.         AISetCutsceneMode(kneelActor);
  476.         ResetThing(t_Player);
  477.             
  478.         SetExtCamOffset('-0.1 -0.05 0.07');
  479.  
  480.         
  481.         PlayKey(kneelActor, kneelDown, 2, 0x12, 1);
  482.                 
  483.         kneelTrack = PlayKey(kneelActor, kneel, 2, 0x14, 0);
  484.                 
  485.         Sleep(0.5);
  486.         
  487.         ClearThingFlags(moveeye, 0x10);
  488.         ChangeInv(t_Player, 78, -1);
  489.         
  490.         #ClearThingFlags(moveeye, 0x80000);
  491.         PlaySoundLocal(eyeplaced, 1.0, 0, 0x0000, 1);
  492.         PlayVoice(kneelActor, fits, 1.0, 0);
  493.         StopKey(kneelActor, kneelTrack, 0.0);            # no longer kneeling
  494.         PlayKey(kneelActor, standUp, 2, 0x12, 1);        # indy stands up
  495.         
  496.         
  497.         #Switch to shot of pyramid so we can get Indy out of the way.
  498.         SetCameraFocus(2, topCam);
  499.         SetCameraSecondaryFocus(2, top);
  500.         SetCurrentCamera(2);
  501.         SetCameraFOV(110, 0, 0.0);
  502.  
  503.         CSShake = 1;
  504.         SetPulse(0.01);
  505.         
  506.         PlaySoundThing(pyrMoveSnd, top, 1.0, -1.0, -1.0, 0x0);
  507.         MoveToFrame(top, 1, 1.0);
  508.         
  509.         ClearSurfaceFlags(ledge0, 0x1000000);
  510.         ClearSurfaceFlags(ledge1, 0x1000000);
  511.         ClearSurfaceFlags(ledge2, 0x1000000);
  512.         ClearSurfaceFlags(ledge3, 0x1000000);
  513.         
  514.         
  515.         DestroyThing(kneelActor);
  516.         ClearThingFlags(indy, 0x80000);
  517.         CopyPlayerHolsters(t_Player, indy);
  518.         CopyOrientandPos(indy, t_Player);
  519.         AISetCutsceneMode(indy);
  520.         AIEnableHeadTracking(indy, moveeye);
  521.         #AISetLookThing(indy, riseGhost);
  522.         Sleep(3.5);
  523.         
  524.         SetCameraPosInterp(2, 1);
  525.         SetCameraInterpSpeed(2, 7.5);
  526.         Sleep(0.01);
  527.         
  528.         SetCameraFocus(2, cam0);
  529.         SetCameraSecondaryFocus(2, riseGhost);
  530.         MoveThingToPos(riseGhost, GetThingPos(risenGhost), 7.5);
  531.         SetCameraFOV(50, 0, 0.0);
  532.         SetCameraFOV(90, 1, 7.5);
  533.  
  534.         
  535.         SetCameraFocus(2, cam1);
  536.         #SetCameraSecondaryFocus(2, boss);
  537.         #SetCurrentCamera(2);
  538.         #SetCameraFOV(90, 0, 0.0);
  539.         
  540.         bossSndTrack1=PlaySoundLocal(bossMus, 1.0, 0.0, 0x0, 0);
  541.         bossSndTrack2=PlaySoundThing(bossRaiseSnd, elev0, 1, -1.0, -1.0, 0x8);
  542.  
  543.         Rotate(door0, -180, 2, 2.0);
  544.         Rotate(door1, 180, 2, 2.0);
  545.         SetCollideType(boss, 0);
  546.         SetCollideType(moveeye, 0);
  547.         SetCollideType(elev0, 0);
  548.         Sleep(1.0);
  549.         MoveToFrame(elev0, 1, 1.0);
  550.         Sleep(6.0);
  551.         ChangeSoundVol(bossSndTrack1, 0.2, 0.2);
  552.         ChangeSoundVol(bossSndTrack2, 0.2, 0.2);
  553.         Sleep(0.01);
  554.         PlayKey(indy, in_ltarmup, 4, 0x12, 0);
  555.         PlayVoice(indy, bossComment, 1, 0);
  556.         Sleep(5.5);
  557.         PlayKey(indy, in_botharmsup, 4, 0x12, 0);
  558.         Sleep(3.0);
  559.  
  560.         #WaitForStop(elev0);
  561.         #Sleep(1.0);
  562.         SetThingFlags(indy, 0x80000);
  563.         ClearThingFlags(t_Player, 0x80000);
  564.         DestroyThing(indy);
  565.         
  566.         
  567.         # revert cam
  568. #        v_targetpos = VectorAdd(VectorTransformToOrient(t_Player, '0.05 -0.2 0.0'), GetThingPos(t_player));    
  569.         SetCameraPosition(1, GetThingPos(cam1));
  570.  
  571.         # Send User0 msg == special 'Create' Boss msg
  572.         t_RealBoss = SendMessageEx(cog_Boss, USER0, boss, 0, 0, 0);        # (cogRef, USER0, Location-Thing, 0, 0, 0)
  573.  
  574.         DestroyThing(boss);
  575.         DestroyThing(moveeye);
  576.  
  577.         
  578.         SetCurrentCamera(1);
  579.         RestoreExtCam();
  580.         SetCameraFOV(90, 0, 0.0);
  581.         
  582.         ClearActorFlags(t_Player, 0x200000);
  583.         SetCollideType(door0, 3);
  584.         SetCollideType(door1, 3);
  585.         EndCutScene();
  586.     }
  587.  
  588. return;
  589.  
  590.  
  591. #........................................................................................
  592. damaged:    
  593.  
  594.     if (GetParam(1) != 0x4000) return;
  595.  
  596.     n_sender = GetSenderRef();
  597.  
  598.     if (n_sender == sarcCharger)
  599.     {
  600.         Sleep(0.5);
  601.  
  602.         if ( MakeMeStop() == -1 )
  603.             return;
  604.         DeselectWeaponWait(t_Player);
  605.         StartCutscene(1);
  606.         
  607.         MoveToFrame(sarcCharger, 0, 0.5);
  608.         PlaySoundThing(snd_chargerMove, sarcCharger, 1.0, -1.0, -1.0, 0x80);
  609.         
  610.         Sleep(0.5);
  611.  
  612.         SetThingFlags(t_Player, 0x80000);
  613.         ResetThing(t_Player);
  614.         
  615.         SetCameraFocus(2, sarcCam);
  616.         SetCameraSecondaryFocus(2, sarcTarg0);
  617.         SetCurrentCamera(2);
  618.         SetCameraFOV(90, 0, 0.0);
  619.     
  620.         CopyOrientAndPos(t_Player, actor);
  621.         CopyPlayerHolsters(t_Player, actor);
  622.         ClearThingFlags(actor, 0x80000);
  623.         
  624.         AISetCutsceneMode(actor);
  625.         AISetMoveSpeed(actor, 1.0);
  626.         ResumeKey(sarcfull, tracknum0);
  627.         PlaySoundThing(sarcFlipSnd, sarcFull, 1.0, -1.0, -1.0, 0x0);
  628.         Sleep(0.5);
  629.  
  630.         AISetLookThing(actor, sarcFull);
  631.         Sleep(0.5);
  632.         AISetMoveThing(actor, actorGhost, 0);
  633.         
  634.         Sleep(1.0);
  635.         AISetLookThing(actor, sarcEmpty);
  636.         
  637.         PlayVoice(actor, eyeVoice, 1, 1);
  638.         PlayKey(actor, grabKey, 4, 0x12, 0);
  639.  
  640.         Sleep(1.0);
  641.         StopAnim(tracknum0);
  642.         DestroyThing(sarcfull);
  643.         ClearThingFlags(sarcempty, 0x80000);
  644.         ChangeInv(t_Player, 78, 1.0);
  645.         SetInvAvailable(t_Player, 78, 1);
  646.         JonesInvItemChanged(78);
  647.         
  648.         tracknum1=PlayKey(sarcempty, sarcclose, 4, 0x4, 0);
  649.         SetCollideType(invisibox0, 0);
  650.         
  651.         PlaySoundThing(sarcCloseSnd, sarcEmpty, 1.0, -1.0, -1.0, 0x0);
  652.         
  653.         CopyOrientAndPos(actor, t_Player);
  654.         ClearActorFlags(t_Player, 0x200000);
  655.         ClearThingFlags(t_Player, 0x80000);
  656.         SetThingFlags(actor, 0x80000);
  657.  
  658.         # revert cam
  659.         v_targetpos = VectorAdd(VectorTransformToOrient(t_Player, '-0.2 -0.05 0.0'), GetThingPos(t_player));    
  660.         SetCameraPosition(1, v_targetpos);
  661.         
  662.         SetCurrentCamera(1);
  663.  
  664.         EndCutScene();
  665.     }
  666.     else
  667.     {
  668.         # Charged a pad of death?
  669.         call ChargePadFx;
  670.     }
  671.  
  672.     return;
  673.  
  674. #........................................................................................
  675. arrived:
  676.     if (GetSenderRef() == top)
  677.     {
  678.         PlaySoundThing(pyrStopSnd, top, 1.0, -1.0, -1.0, 0x0);
  679.         CSShake = 0;
  680.         SetPulse(0.0);
  681.         return;
  682.     }
  683.  
  684.     if (GetSenderRef() == elev0)
  685.     {
  686. #        print("uh, oh...hold on there big guy...");
  687. #
  688. #        Sleep(9.5);
  689. #
  690. #        # Send User0 msg == special 'Create' Boss msg
  691. #        t_RealBoss = SendMessageEx(cog_Boss, 27, boss, 0, 0, 0);        # (cogRef, User0, Location-Thing, 0, 0, 0)
  692. #
  693. #        DestroyThing(boss);
  694. #        DestroyThing(moveeye);
  695.     }
  696.  
  697.     return;
  698.     
  699. #........................................................................................
  700. touched:
  701.     if ((GetSenderRef() == moveeye) && (bossOnce == 0))
  702.     {
  703.         PlayVoice(t_player, socketVoice, 1, 0);
  704.         bossOnce=1;
  705.     }
  706.     return;
  707.  
  708.  
  709. #........................................................................................
  710. callback:
  711.     callbackNum = GetParam(1);
  712.     if (callbackNum != 21) return;
  713.     if (callbackOnce == 1) return;
  714.     callbackOnce = 1;    
  715.     PauseKey(sarcfull, tracknum0);
  716.     AISetCutsceneMode(actor);
  717.     AISetLookThing(actor, sarcfull);
  718.     Sleep(2.0);
  719.     PlayVoice(actor, nubVoice, 1, 1);
  720.  
  721.     Sleep(1.0);
  722.     MoveThingToPos(sarcTarg0, GetThingPos(sarcCharger), 2.0);
  723.     SetCameraFOV(40, 1, 2.0);
  724.     headTurn = GetThingMaxHeadVel(actor);
  725.     SetThingMaxHeadVel(actor, 100);
  726.     Sleep(0.5);
  727.     #AISetLookThing(actor, sarcCharger);
  728.     MoveToFrame(sarcCharger, 1, 0.5);
  729.     AIEnableHeadTracking(actor, sarcCharger);
  730.     PlaySoundThing(snd_chargerMove, sarcCharger, 1.0, -1.0, -1.0, 0x80);
  731.     CopyOrientandPos(actor, t_Player);
  732.     Sleep(2.0);
  733.     SetThingMaxHeadVel(actor, headTurn);
  734.     AIDisableHeadTracking(actor);
  735.  
  736.     # revert cam
  737.     v_targetpos = VectorAdd(VectorTransformToOrient(t_Player, '-0.2 -0.05 0.0'), GetThingPos(t_player));    
  738.     SetCameraPosition(1, v_targetpos);
  739.     
  740.     SetCurrentCamera(1);
  741.     ClearActorFlags(t_Player, 0x200000);
  742.     ClearThingFlags(t_Player, 0x80000);
  743.     SetThingFlags(actor, 0x80000);
  744.     EndCutScene();
  745.     MoveThingToPos(sarcTarg0, GetThingPos(sarcTarg1), 0.0);
  746.  
  747.     return;
  748.  
  749.  
  750.  
  751. # ===================================================================
  752. #    Subroutines
  753. # ===================================================================
  754.  
  755. #........................................................................................
  756. # n_sender (which charger) must be initialized for this to work
  757. #........................................................................................
  758. ChargePadFx:
  759.  
  760.     for (n_idx=0; n_idx < i_NumPads; n_idx=n_idx + 1)
  761.     {
  762.         if ( n_sender == charger0[n_idx] )
  763.         {
  764.             if (pad0charged[n_idx] == 0)
  765.             {
  766.                 MoveToFrame(charger0[n_idx], 1, 1.0);                        # Move charger plate in
  767.                 
  768.                 n_snd = PlaySoundThing(snd_padHum, charger0[n_idx], 1.0, -1.0, -1.0, 0x81);
  769.                 SetThingUserData(charger0[n_idx], n_snd);                    # Save hum sound handle
  770.  
  771.                 pad0charged[n_idx]    = 1;                                    # Mark pad as charged
  772.                 pad0track[n_idx]    = SurfaceAnim(pad0[n_idx], 3.8, 1);        # Start pad animating
  773.                 SetFaceLightMode(pad0[n_idx], 0);                            # Set pad lighting mode
  774.             }
  775.         }
  776.         else
  777.         {
  778.             MoveToFrame(charger0[n_idx], 0, 1.0);                        # Move charger plate back out
  779.             PlaySoundThing(snd_chargerMove, charger0[n_idx], 1.0, -1.0, -1.0, 0x80);
  780.         }
  781.     }
  782.  
  783.     return;
  784.  
  785. #........................................................................................
  786. # n_BossPad and/or n_PlayerPad (which pad to discharge) must be intialized for this to work
  787. #........................................................................................
  788. DischargePadFx:
  789.  
  790.     if ( b_hitBoss == 1 )
  791.     {
  792.         n_pad = n_BossPad;
  793.     }
  794.     else
  795.     {
  796.         n_pad = n_PlayerPad;
  797.     }
  798.  
  799.     n_snd = GetThingUserData(charger0[n_pad]);                    # Get hum sound handle
  800.     StopSound(n_snd, 0.2);                                        # Stop humming!
  801.  
  802.     pad0charged[n_pad] = 0;                                        # Mark pad as discharged
  803.     StopAnim(pad0track[n_pad]);                                    # Stop pad animating
  804.     SetFaceLightMode(pad0[n_pad], 3);                            # Reset pad lighting mode
  805.     SetWallCel(pad0[n_pad], 0);
  806.  
  807.     if ( b_hitBoss == 1 )
  808.     {
  809. #        DEBUGFLEX(n_BossPad, "Boss discharging pad");
  810.         b_hitBoss = 0;
  811.  
  812.         SendMessageEx(cog_Boss, USER1, 120, 0, 0, 0);                # Send USER1 msg == special 'Damage' Boss msg
  813.  
  814.         vec_dir    = VectorSet(0, 0.1, 0);                                # Large scale boss sparks
  815.         for (n_idx = 0; n_idx < 8; n_idx = n_idx + 1)
  816.         {
  817.             vec_dir    = VectorRotate(vec_dir, '0 45 0');
  818.             vec_pos = VectorAdd(GetThingPos(t_RealBoss), vec_dir);
  819.             CreateThingAtPos(tpl_sparks, FindNewSectorFromThing(t_RealBoss, vec_pos), vec_pos, '0 0 0');
  820.         }
  821.  
  822.         vec_pos = GetThingPos(t_RealBoss);
  823.         vec_pos = VectorSet(VectorX(vec_pos), VectorY(vec_pos), VectorZ(vec_pos)-VectorZ(GetThingInsertOffset(t_RealBoss)));
  824.         sec_pos = FindNewSectorFromThing(t_RealBoss, vec_pos);
  825.         CreateThingAtPos(tpl_glow, sec_pos, vec_pos, '0 0 0');
  826.         CreateThingAtPos(tpl_arcs, sec_pos, vec_pos, '0 0 0');
  827.     }
  828.     else if ( b_hitPlayer == 1 )
  829.     {
  830. #        DEBUGFLEX(n_PlayerPad, "Player discharging pad");
  831.  
  832.         if ( MakeMeStop() == -1 )
  833.             return;
  834.  
  835.         b_hitPlayer = 0;
  836.  
  837.         vec_pos = GetThingPos(t_Player);
  838.         vec_pos = VectorSet(VectorX(vec_pos), VectorY(vec_pos), VectorZ(vec_pos)-VectorZ(GetThingInsertOffset(t_Player)));
  839.         CreateThingAtPos(tpl_glow, FindNewSectorFromThing(t_Player, vec_pos), vec_pos, '0 0 0');
  840.         CreateThingAtPos(tpl_sparks, GetThingSector(t_Player), GetThingPos(t_Player), '0 0 0');
  841.  
  842.         DamageThing(t_Player, 200, 0x100000, t_Player);                # Smack player with DAMAGE_LIGHTNING
  843.  
  844.         if ( GetThingHealth(t_Player) > 0 )
  845.         {
  846.             PlaySoundLocal(snd_ow, 1.0, 0.0, 0x0, 0);
  847.             PlaySoundLocal(snd_shock, 1.0, 0.0, 0x0, 0);
  848.             PlayKey(t_player, key_inShock, 6, 0x12, 1);
  849.         }
  850.     }
  851.  
  852.     return;
  853.  
  854.  
  855. #........................................................................................
  856. BossDeadCutscene:
  857.  
  858.  
  859. #Determine boss's direction
  860. if (n_BossPad == 0)            #boss is on northeast pad
  861. {
  862.     camSpot = 0;
  863.     v_Bosslvec = GetThingLVec(t_RealBoss);
  864.     v_BossFace = VectorSub((GetThingPos(deadCam1)), (GetThingPos(t_RealBoss)));
  865.  
  866.     f_dot = VectorDot(VectorNorm(v_BossFace), v_Bosslvec);
  867.     
  868.     if (f_dot < 0)
  869.     {
  870.         camSpot = north;
  871.     }
  872.     else
  873.     {
  874.         camSpot = east;
  875.     }
  876. }
  877.  
  878. if (n_BossPad == 1)            #boss is on southeast pad
  879. {
  880.     camSpot = 0;
  881.     v_Bosslvec = GetThingLVec(t_RealBoss);
  882.     v_BossFace = VectorSub((GetThingPos(deadCam2)), (GetThingPos(t_RealBoss)));
  883.  
  884.     f_dot = VectorDot(VectorNorm(v_BossFace), v_Bosslvec);
  885.     
  886.     if (f_dot < 0)
  887.     {
  888.         camSpot = east;
  889.     }
  890.     else
  891.     {
  892.         camSpot = south;
  893.     }
  894. }
  895.  
  896.  
  897. if (n_BossPad == 2)            #boss is on southwest pad
  898. {
  899.     camSpot = 0;
  900.     v_Bosslvec = GetThingLVec(t_RealBoss);
  901.     v_BossFace = VectorSub((GetThingPos(deadCam3)), (GetThingPos(t_RealBoss)));
  902.  
  903.     f_dot = VectorDot(VectorNorm(v_BossFace), v_Bosslvec);
  904.     
  905.     if (f_dot < 0)
  906.     {
  907.         camSpot = south;
  908.     }
  909.     else
  910.     {
  911.         camSpot = west;
  912.     }
  913. }
  914.  
  915. if (n_BossPad == 3)                #boss is on northwest pad
  916. {
  917.     camSpot = 0;
  918.     v_Bosslvec = GetThingLVec(t_RealBoss);
  919.     v_BossFace = VectorSub((GetThingPos(deadCam0)), (GetThingPos(t_RealBoss)));
  920.  
  921.     f_dot = VectorDot(VectorNorm(v_BossFace), v_Bosslvec);
  922.     
  923.     if (f_dot < 0)
  924.     {
  925.         camSpot = west;
  926.     }
  927.     else
  928.     {
  929.         camSpot = north;
  930.     }
  931. }
  932.  
  933.     print("got him...!");
  934.     StartCutscene(1);
  935.     StopThing(t_Player);
  936.     SetActorFlags(t_Player, 0x200000);
  937.     PlayMode(t_Player, 1, 0);
  938.     
  939.     SetCameraLookInterp(2, 0); # no p & t
  940.     SetCameraPosInterp(2, 0); # no dolly
  941.  
  942.     SetCameraFocus(2, deadCam0[camspot]);
  943.     SetCameraSecondaryFocus(2, t_RealBoss);
  944.     SetCurrentCamera(2);
  945.     SetCameraFOV(90, 0, 0.0);
  946.  
  947.  
  948.     PlaySoundLocal(bossDieMus, 1.0, 0.0, 0x0, 0);
  949.     
  950.     SetCameraLookInterp(2, 1); # no p & t
  951.     SetCameraInterpSpeed(2, 3.0);
  952.  
  953.     Sleep(4.0);
  954.     SetCameraSecondaryFocus(2, top);
  955.     Sleep(1.0);
  956.     PlaySoundThing(pyrMoveSnd, top, 1.0, -1.0, -1.0, 0x0);
  957.     MoveToFrame(top, 0, 1.0);
  958.     SetSurfaceFlags(ledge0, 0x1000000);
  959.     SetSurfaceFlags(ledge1, 0x1000000);
  960.     SetSurfaceFlags(ledge2, 0x1000000);
  961.     SetSurfaceFlags(ledge3, 0x1000000);
  962.     Sleep(5.0);
  963.     
  964.     # revert cam
  965.     v_targetpos = VectorAdd(VectorTransformToOrient(t_Player, '-0.2 -0.05 0.0'), GetThingPos(t_player));    
  966.     SetCameraPosition(1, v_targetpos);
  967.     SendMessage(hint, user2);
  968.     
  969.         
  970.     SetCurrentCamera(1);
  971.     SetCameraFOV(90, 0, 0.0);
  972.     ClearActorFlags(t_Player, 0x200000);
  973.     EndCutScene();
  974.  
  975.     return;
  976.  
  977. #........................................................................................
  978. end
  979.  
  980.